package com.xs.bookspoststation.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;


import com.xs.bookspoststation.R;
import com.xs.bookspoststation.bean.Student;

import java.util.List;

public class StudentAdapter extends ArrayAdapter {

    //实体类
    Student student;

    public void setStudent(Student student) {
        this.student = student;
    }

    public StudentAdapter(Context context, int resource, List<Student> studentList) {
        super(context, resource, studentList);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        student = (Student) getItem(position);
        View view = LayoutInflater.from(getContext()).inflate(R.layout.studentlist, null);

        TextView sel_sno2 =(TextView)view.findViewById(R.id.sel_sno2);
        TextView sel_sname2 =(TextView)view.findViewById(R.id.sel_sname2);
        TextView sel_spwd2 =(TextView)view.findViewById(R.id.sel_spwd2);
        TextView sel_sex2 =(TextView)view.findViewById(R.id.sel_sex2);
        TextView sel_sphone2 =(TextView)view.findViewById(R.id.sel_sphone2);
        TextView sel_sclass2 =(TextView)view.findViewById(R.id.sel_sclass2);
        TextView sel_spro2 =(TextView)view.findViewById(R.id.sel_spro2);
        TextView sel_sde2 =(TextView)view.findViewById(R.id.sel_sde2);
        sel_sno2.setText(student.getSno());
        sel_sname2.setText(student.getSname());
        sel_spwd2.setText(student.getSpwd());
        sel_sex2.setText(student.getSex());
        sel_sclass2.setText(student.getSclass());
        sel_sphone2.setText(student.getSphone());
        sel_spro2.setText(student.getSpro());
        sel_sde2.setText(student.getSde());
        return view;

    }
}
